package com.heima.user.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.heima.api.user.ApUserFollowControllerApi;
import com.heima.model.user.pojos.ApUserFollow;
import com.heima.user.service.ApUserFollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @作者 itcast
 * @创建日期 2020/10/8 16:56
 **/
@RestController
@RequestMapping("/api/v1/user_follow")
public class ApUserFollowController implements ApUserFollowControllerApi {
    @Autowired
    private ApUserFollowService apUserFollowService;

    @GetMapping("/one")
    @Override
    public ApUserFollow findByUserIdAndFollowId(@RequestParam("userId") Integer userId,
                                                @RequestParam("followId") Integer followId) {
        return apUserFollowService.getOne(
                Wrappers.<ApUserFollow>lambdaQuery()
                        .eq(ApUserFollow::getUserId,userId)
                        .eq(ApUserFollow::getFollowId,followId)
        );
    }
}
